# Importing Data
GERMANY<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "M1:M229")

# Checking the Imported Data
View(GERMANY)
# Creating Time Series Data
GERMANY_ts <- ts(GERMANY, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
GERMANY_ts
sum(is.na(GERMANY_ts))
library(forecast)
GERMANY_ts <- tsclean(GERMANY_ts)
GERMANY_ts

# Identification: Plotting the Time Series Data
plot(GERMANY_ts)

# Estimating the appropriate model
GERMANY_ts_model <- auto.arima(GERMANY_ts)
GERMANY_ts_model

# Forecasting
options(max.print=1000000)
GERMANY_ts_forecast <- forecast (GERMANY_ts_model, level=c(95), h=288)
plot(GERMANY_ts_forecast)
GERMANY_ts_forecast             

# Exporting
write.table(GERMANY_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/GERMANY_TSA.csv", sep=",")
